/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.Core.impl;

import EA_Model.IEC61970.Core.CorePackage;
import EA_Model.IEC61970.Core.RegularIntervalSchedule;

import EA_Model.IEC61970.Domain.AbsoluteDateTime;
import EA_Model.IEC61970.Domain.Seconds;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Regular Interval Schedule</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.Core.impl.RegularIntervalScheduleImpl#getEndTime <em>End Time</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Core.impl.RegularIntervalScheduleImpl#getTimeStep <em>Time Step</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class RegularIntervalScheduleImpl extends BasicIntervalScheduleImpl implements RegularIntervalSchedule {
	/**
	 * The cached value of the '{@link #getEndTime() <em>End Time</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEndTime()
	 * @generated
	 * @ordered
	 */
	protected AbsoluteDateTime endTime;

	/**
	 * The cached value of the '{@link #getTimeStep() <em>Time Step</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTimeStep()
	 * @generated
	 * @ordered
	 */
	protected Seconds timeStep;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected RegularIntervalScheduleImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return CorePackage.Literals.REGULAR_INTERVAL_SCHEDULE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AbsoluteDateTime getEndTime() {
		if (endTime != null && endTime.eIsProxy()) {
			InternalEObject oldEndTime = (InternalEObject)endTime;
			endTime = (AbsoluteDateTime)eResolveProxy(oldEndTime);
			if (endTime != oldEndTime) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, CorePackage.REGULAR_INTERVAL_SCHEDULE__END_TIME, oldEndTime, endTime));
			}
		}
		return endTime;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AbsoluteDateTime basicGetEndTime() {
		return endTime;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setEndTime(AbsoluteDateTime newEndTime) {
		AbsoluteDateTime oldEndTime = endTime;
		endTime = newEndTime;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.REGULAR_INTERVAL_SCHEDULE__END_TIME, oldEndTime, endTime));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Seconds getTimeStep() {
		if (timeStep != null && timeStep.eIsProxy()) {
			InternalEObject oldTimeStep = (InternalEObject)timeStep;
			timeStep = (Seconds)eResolveProxy(oldTimeStep);
			if (timeStep != oldTimeStep) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, CorePackage.REGULAR_INTERVAL_SCHEDULE__TIME_STEP, oldTimeStep, timeStep));
			}
		}
		return timeStep;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Seconds basicGetTimeStep() {
		return timeStep;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTimeStep(Seconds newTimeStep) {
		Seconds oldTimeStep = timeStep;
		timeStep = newTimeStep;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.REGULAR_INTERVAL_SCHEDULE__TIME_STEP, oldTimeStep, timeStep));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case CorePackage.REGULAR_INTERVAL_SCHEDULE__END_TIME:
				if (resolve) return getEndTime();
				return basicGetEndTime();
			case CorePackage.REGULAR_INTERVAL_SCHEDULE__TIME_STEP:
				if (resolve) return getTimeStep();
				return basicGetTimeStep();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case CorePackage.REGULAR_INTERVAL_SCHEDULE__END_TIME:
				setEndTime((AbsoluteDateTime)newValue);
				return;
			case CorePackage.REGULAR_INTERVAL_SCHEDULE__TIME_STEP:
				setTimeStep((Seconds)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case CorePackage.REGULAR_INTERVAL_SCHEDULE__END_TIME:
				setEndTime((AbsoluteDateTime)null);
				return;
			case CorePackage.REGULAR_INTERVAL_SCHEDULE__TIME_STEP:
				setTimeStep((Seconds)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case CorePackage.REGULAR_INTERVAL_SCHEDULE__END_TIME:
				return endTime != null;
			case CorePackage.REGULAR_INTERVAL_SCHEDULE__TIME_STEP:
				return timeStep != null;
		}
		return super.eIsSet(featureID);
	}

} //RegularIntervalScheduleImpl
